package krakow.ae.knp.wikiboard.gui.tools.markers;

import java.awt.Graphics2D;
import java.awt.geom.Point2D;

/**
 * An abstract class which represents the parent
 * of all figure markers.
 */
public abstract class FigureMarker {
    
    /** name of the figure marker */
    protected String name;
    
    /**
     * Constructor of FigureMarker
     *
     * @param name the name of the figure marker
     */
    public FigureMarker(String name) {
        this.name = name;
    }
    
    /**
     * Method which draws the figure on the board
     * @param g the graphics context to draw to
     * @param dragged defines if the figure is being dragged
     */
    public abstract void drawFigure(Graphics2D g, boolean dragged);
    
    /**
     * Method which draws the figure on the board when it is dragged
     * @param g the graphics context to draw to
     *
     */
   // public abstract void drawDraggedFigure(Graphics2D g);
    
    /**
     * Method which is called by the Board when the mouse is pressed.
     *
     * @param x the x position of the mouse pointer
     * @param y the y position of the mouse pointer
     * @param g the graphics context to draw to.
     *
     */
    public abstract void mousePressed(int x, int y, Graphics2D g);
    
    /**
     * Method which is called by the Board when the mouse is dragged.
     *
     * @param x the x position of the mouse pointer
     * @param y the y position of the mouse pointer
     * @param g the graphics context to draw to.
     *
     */
    public abstract void mouseDragged(int x, int y, Graphics2D g);
    
    /**
     * Method which is called by the Board when the mouse is released.
     * @param x the x position of the mouse pointer
     * @param y the y position of the mouse pointer
     * @param g the graphics context to draw to.
     * @return true if the pressed point = released point
     */
    public abstract boolean mouseReleased(int x, int y, Graphics2D g);
    
    /**
     * Checks if the figure is in the specified point
     * @param p the point that is checked
     * @return true if it is
     */
    public abstract boolean contains(Point2D p);
    
    /**
     * Moves the drawn figure
     * @param x the x position of the mouse pointer
     * @param y the y position of the mouse pointer
     */
    public abstract void move(double x, double y);
    
}
